﻿namespace User.Api.BizExtensions
{
    public static class DepartExtensions
    {
        /// <summary>
        /// 分院名称转分院代码
        /// </summary>
        /// <param name="branchName">拼音名称</param>
        /// <returns></returns>
        public static string ToBranchNo(string branchName)
        {
            if (string.IsNullOrEmpty(branchName))
            {
                return "";
            }
            if (branchName.ToUpper() == "PANYU")
            {
                return "01";
            }
            if (branchName.ToUpper() == "YUEXIU")
            {
                return "02";
            }
            if (branchName.ToUpper() == "HAIZHU")
            {
                return "03";
            }

            return "";
        }

        /// <summary>
        /// 分院代码转分院名称，返回的分院名称为小写
        /// </summary>
        /// <param name="branchNo">分院代码</param>
        /// <returns></returns>
        public static string ToBranchName(string branchNo)
        {
            if (branchNo == "01")
            {
                return "panyu";
            }
            if (branchNo == "02")
            {
                return "yuexiu";
            }
            if (branchNo == "03")
            {
                return "haizhu";
            }

            return "";
        }
    }
}